package com.ag.wsq.dao;

import java.sql.SQLException;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;

import com.ag.bean.TbUser;
import com.ag.dao.TbUserDAO;

public class UserDAO extends TbUserDAO {
	
	private static final Log log = LogFactory.getLog(UserDAO.class);
	
	/**
	 * 根据UName拿UId
	 */
	/*public List  getUserByName(final String UName) throws Exception{
		log.info("start getUserByName---------------");
		final String queryStr = "from TbUser u where u.UName=?";
		return getHibernateTemplate().executeFind(new HibernateCallback() {
			public Object doInHibernate(Session s) throws HibernateException,
					SQLException {
				Query query = s.createQuery(queryStr);
				
				List list = query.list();
				
				if(list.size()>0){
					TbUser user =  (TbUser) list.get(0);
				}

				return user;
			}
		});
	}*/
	/**
	 *findByUName
	 */
	public List findByUName(String UName1){
		
		List list = this.findByProperty("UName", UName1);
		
		return list;
	}
}
